!function(e,t){var define;"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.obtp=t():e.obtp=t()}(this,(()=>(()=>{"use strict";var e={};function t(e){return Array.isArray(e)}(e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e);var s=function(){},n=function(e,t,s){var n=e[t];e[t]=function(){for(var e=[],t=0;tthis.validNameLength&&(r(c.Warning,"Event name length cannot exceed 100 characters",e.name),1)):(r(c.Warning,"Event Name invalid",e.name),!1)},e}()),I=new(function(){function e(){}return e.prototype.getParamFromUrl=function(e){var t=this.getLocation();t.indexOf("#")>-1&&(t=t.substring(0,t.indexOf("#")));for(var s=(t.split("?")[1]||"").split(/&/),n=0;n-1&&t.didomiPurposesConsent.indexOf("measure_ad_performance")>-1)},e}()),U=new(function(){function e(){}return e.prototype.hasConsentHandler=function(){return void 0!==window.OnetrustActiveGroups},e.prototype.handleConsent=function(e){var t=this;this.cb=e;var s=function(){var e=window.OnetrustActiveGroups.split(",").map((function(e){return e.trim().toUpperCase()}));return["C0001","C0002","C0003","C0004"].every((function(t){return e.includes(t)}))||["1","2","3","4"].every((function(t){return e.includes(t)}))};if(s())this.cb(!0);else if("OneTrust"in window)window.OneTrust.OnConsentChanged((function(){t.cb(s())}));else{var n=Re.zone===i.Default;this.cb(n)}},e}()),F=new(function(){function e(){}return e.prototype.hasConsentHandler=function(){return!!window.google_tag_data},e.prototype.handleConsent=function(e){var t;if(Re.zone!==i.Default){var s=window.google_tag_data;if(null===(t=null==s?void 0:s.ics)||void 0===t?void 0:t.entries){var n=["ad_storage","ad_user_data"],r=function(){return n.every((function(e){var t;return!0===(null===(t=s.ics.entries[e])||void 0===t?void 0:t.update)}))};e(r()),!r()&&s.ics.addListener&&s.ics.addListener(n,(function(){e(r())}))}else e(!1)}else e(!0)},e}());!function(e){e[e.DecodeFailed=1]="DecodeFailed",e[e.Disclosed=2]="Disclosed",e[e.NoDisclosureDataBeforeCutoff=3]="NoDisclosureDataBeforeCutoff",e[e.NotDisclosedBeforeCutoff=4]="NotDisclosedBeforeCutoff",e[e.NoDisclosureDataAfterCutoff=5]="NoDisclosureDataAfterCutoff",e[e.NotDisclosedAfterCutoff=6]="NotDisclosedAfterCutoff"}(P||(P={}));var x,H,B,M,G=new Set([P.DecodeFailed,P.NotDisclosedAfterCutoff]);class j extends Error{constructor(e){super(e),this.name="DecodingError"}}class z extends Error{constructor(e){super(e),this.name="EncodingError"}}class W extends Error{constructor(e){super(e),this.name="GVLError"}}class $ extends Error{constructor(e,t,s=""){super(`invalid value ${t} passed for ${e} ${s}`),this.name="TCModelError"}}class Y{static DICT="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";static REVERSE_DICT=new Map([["A",0],["B",1],["C",2],["D",3],["E",4],["F",5],["G",6],["H",7],["I",8],["J",9],["K",10],["L",11],["M",12],["N",13],["O",14],["P",15],["Q",16],["R",17],["S",18],["T",19],["U",20],["V",21],["W",22],["X",23],["Y",24],["Z",25],["a",26],["b",27],["c",28],["d",29],["e",30],["f",31],["g",32],["h",33],["i",34],["j",35],["k",36],["l",37],["m",38],["n",39],["o",40],["p",41],["q",42],["r",43],["s",44],["t",45],["u",46],["v",47],["w",48],["x",49],["y",50],["z",51],["0",52],["1",53],["2",54],["3",55],["4",56],["5",57],["6",58],["7",59],["8",60],["9",61],["-",62],["_",63]]);static BASIS=6;static LCM=24;static encode(e){if(!/^[0-1]+$/.test(e))throw new z("Invalid bitField");const t=e.length%this.LCM;e+=t?"0".repeat(this.LCM-t):"";let s="";for(let t=0;t=2&&2==t.length){if(K.langSet.has(e))return e;if(K.langSet.has(t))return t;const s=t+"-"+t;if(K.langSet.has(s))return s;for(const s of K.langSet)if(-1!==s.indexOf(e)||-1!==s.indexOf(t))return s}throw new Error(`unsupported language ${e}`)}forEach(e){K.langSet.forEach(e)}get size(){return K.langSet.size}}class Z{static cmpId="cmpId";static cmpVersion="cmpVersion";static consentLanguage="consentLanguage";static consentScreen="consentScreen";static created="created";static supportOOB="supportOOB";static isServiceSpecific="isServiceSpecific";static lastUpdated="lastUpdated";static numCustomPurposes="numCustomPurposes";static policyVersion="policyVersion";static publisherCountryCode="publisherCountryCode";static publisherCustomConsents="publisherCustomConsents";static publisherCustomLegitimateInterests="publisherCustomLegitimateInterests";static publisherLegitimateInterests="publisherLegitimateInterests";static publisherConsents="publisherConsents";static publisherRestrictions="publisherRestrictions";static purposeConsents="purposeConsents";static purposeLegitimateInterests="purposeLegitimateInterests";static purposeOneTreatment="purposeOneTreatment";static specialFeatureOptins="specialFeatureOptins";static useNonStandardTexts="useNonStandardTexts";static vendorConsents="vendorConsents";static vendorLegitimateInterests="vendorLegitimateInterests";static vendorListVersion="vendorListVersion";static vendorsAllowed="vendorsAllowed";static vendorsDisclosed="vendorsDisclosed";static version="version"}class q{clone(){const e=new this.constructor;return Object.keys(this).forEach((t=>{const s=this.deepClone(this[t]);void 0!==s&&(e[t]=s)})),e}deepClone(e){const t=typeof e;if("number"===t||"string"===t||"boolean"===t)return e;if(null!==e&&"object"===t){if("function"==typeof e.clone)return e.clone();if(e instanceof Date)return new Date(e.getTime());if(void 0!==e[Symbol.iterator]){const t=[];for(const s of e)t.push(this.deepClone(s));return e instanceof Array?t:new e.constructor(t)}{const t={};for(const s in e)e.hasOwnProperty(s)&&(t[s]=this.deepClone(e[s]));return t}}}}!function(e){e[e.NOT_ALLOWED=0]="NOT_ALLOWED",e[e.REQUIRE_CONSENT=1]="REQUIRE_CONSENT",e[e.REQUIRE_LI=2]="REQUIRE_LI"}(x||(x={}));class J extends q{static hashSeparator="-";purposeId_;restrictionType;constructor(e,t){super(),void 0!==e&&(this.purposeId=e),void 0!==t&&(this.restrictionType=t)}static unHash(e){const t=e.split(this.hashSeparator),s=new J;if(2!==t.length)throw new $("hash",e);return s.purposeId=parseInt(t[0],10),s.restrictionType=parseInt(t[1],10),s}get hash(){if(!this.isValid())throw new Error("cannot hash invalid PurposeRestriction");return`${this.purposeId}${J.hashSeparator}${this.restrictionType}`}get purposeId(){return this.purposeId_}set purposeId(e){this.purposeId_=e}isValid(){return Number.isInteger(this.purposeId)&&this.purposeId>0&&(this.restrictionType===x.NOT_ALLOWED||this.restrictionType===x.REQUIRE_CONSENT||this.restrictionType===x.REQUIRE_LI)}isSameAs(e){return this.purposeId===e.purposeId&&this.restrictionType===e.restrictionType}}class Q extends q{bitLength=0;map=new Map;gvl_;has(e){return this.map.has(e)}isOkToHave(e,t,s){let n=!0;if(this.gvl?.vendors){const r=this.gvl.vendors[s];if(r)if(e===x.NOT_ALLOWED)n=r.legIntPurposes.includes(t)||r.purposes.includes(t);else if(r.flexiblePurposes.length)switch(e){case x.REQUIRE_CONSENT:n=r.flexiblePurposes.includes(t)&&r.legIntPurposes.includes(t);break;case x.REQUIRE_LI:n=r.flexiblePurposes.includes(t)&&r.purposes.includes(t)}else n=!1;else n=!1}return n}add(e,t){if(this.isOkToHave(t.restrictionType,t.purposeId,e)){const s=t.hash;this.has(s)||(this.map.set(s,new Set),this.bitLength=0),this.map.get(s).add(e)}}restrictPurposeToLegalBasis(e){const t=Array.from(this.gvl.vendorIds),s=e.hash,n=t[t.length-1],r=[...Array(n).keys()].map((e=>e+1));if(this.has(s))for(let e=1;e<=n;e++)this.map.get(s).add(e);else this.map.set(s,new Set(r)),this.bitLength=0}getVendors(e){let t=[];if(e){const s=e.hash;this.has(s)&&(t=Array.from(this.map.get(s)))}else{const e=new Set;this.map.forEach((t=>{t.forEach((t=>{e.add(t)}))})),t=Array.from(e)}return t.sort(((e,t)=>e-t))}getRestrictionType(e,t){let s;return this.getRestrictions(e).forEach((e=>{e.purposeId===t&&(void 0===s||s>e.restrictionType)&&(s=e.restrictionType)})),s}vendorHasRestriction(e,t){let s=!1;const n=this.getRestrictions(e);for(let e=0;e{e=Math.max(Array.from(t)[t.size-1],e)})),e}getRestrictions(e){const t=[];return this.map.forEach(((s,n)=>{e?s.has(e)&&t.push(J.unHash(n)):t.push(J.unHash(n))})),t}getPurposes(){const e=new Set;return this.map.forEach(((t,s)=>{e.add(J.unHash(s).purposeId)})),Array.from(e)}remove(e,t){const s=t.hash,n=this.map.get(s);n&&(n.delete(e),0==n.size&&(this.map.delete(s),this.bitLength=0))}set gvl(e){this.gvl_||(this.gvl_=e,this.map.forEach(((e,t)=>{const s=J.unHash(t);Array.from(e).forEach((t=>{this.isOkToHave(s.restrictionType,s.purposeId,t)||e.delete(t)}))})))}get gvl(){return this.gvl_}isEmpty(){return 0===this.map.size}get numRestrictions(){return this.map.size}}!function(e){e.COOKIE="cookie",e.WEB="web",e.APP="app"}(H||(H={})),function(e){e.CORE="core",e.VENDORS_DISCLOSED="vendorsDisclosed",e.VENDORS_ALLOWED="vendorsAllowed",e.PUBLISHER_TC="publisherTC"}(B||(B={}));class X{static ID_TO_KEY=[B.CORE,B.VENDORS_DISCLOSED,B.VENDORS_ALLOWED,B.PUBLISHER_TC];static KEY_TO_ID={[B.CORE]:0,[B.VENDORS_DISCLOSED]:1,[B.VENDORS_ALLOWED]:2,[B.PUBLISHER_TC]:3}}class ee extends q{bitLength=0;maxId_=0;set_=new Set;*[Symbol.iterator](){for(let e=1;e<=this.maxId;e++)yield[e,this.has(e)]}values(){return this.set_.values()}get maxId(){return this.maxId_}has(e){return this.set_.has(e)}unset(e){Array.isArray(e)?e.forEach((e=>this.unset(e))):"object"==typeof e?this.unset(Object.keys(e).map((e=>Number(e)))):(this.set_.delete(Number(e)),this.bitLength=0,e===this.maxId&&(this.maxId_=0,this.set_.forEach((e=>{this.maxId_=Math.max(this.maxId,e)}))))}isIntMap(e){let t="object"==typeof e;return t=t&&Object.keys(e).every((t=>{let s=Number.isInteger(parseInt(t,10));return s=s&&this.isValidNumber(e[t].id),s=s&&void 0!==e[t].name,s})),t}isValidNumber(e){return parseInt(e,10)>0}isSet(e){let t=!1;return e instanceof Set&&(t=Array.from(e).every(this.isValidNumber)),t}set(e){if(Array.isArray(e))e.forEach((e=>this.set(e)));else if(this.isSet(e))this.set(Array.from(e));else if(this.isIntMap(e))this.set(Object.keys(e).map((e=>Number(e))));else{if(!this.isValidNumber(e))throw new $("set()",e,"must be positive integer array, positive integer, Set, or IntMap");this.set_.add(e),this.maxId_=Math.max(this.maxId,e),this.bitLength=0}}empty(){this.set_=new Set,this.maxId_=0}forEach(e){for(let t=1;t<=this.maxId;t++)e(this.has(t),t)}get size(){return this.set_.size}setAll(e){this.set(e)}unsetAll(e){this.unset(e)}}class te{static[Z.cmpId]=12;static[Z.cmpVersion]=12;static[Z.consentLanguage]=12;static[Z.consentScreen]=6;static[Z.created]=36;static[Z.isServiceSpecific]=1;static[Z.lastUpdated]=36;static[Z.policyVersion]=6;static[Z.publisherCountryCode]=12;static[Z.publisherLegitimateInterests]=24;static[Z.publisherConsents]=24;static[Z.purposeConsents]=24;static[Z.purposeLegitimateInterests]=24;static[Z.purposeOneTreatment]=1;static[Z.specialFeatureOptins]=12;static[Z.useNonStandardTexts]=1;static[Z.vendorListVersion]=12;static[Z.version]=6;static anyBoolean=1;static encodingType=1;static maxId=16;static numCustomPurposes=6;static numEntries=12;static numRestrictions=12;static purposeId=6;static restrictionType=2;static segmentType=3;static singleOrRange=1;static vendorId=16}class se{static encode(e,t){let s;if("string"==typeof e&&(e=parseInt(e,10)),s=e.toString(2),s.length>t||e<0)throw new z(`${e} too large to encode into ${t}`);return s.length25||n<0||n>25)throw new z(`invalid language code: ${e}`);if(t%2==1)throw new z(`numBits must be even, ${t} is not valid`);return t/=2,se.encode(s,t)+se.encode(n,t)}static decode(e,t){let s;if(t!==e.length||e.length%2)throw new j("invalid bit length for language");{const t=65,n=e.length/2,r=se.decode(e.slice(0,n),n)+t,o=se.decode(e.slice(n),n)+t;s=String.fromCharCode(r)+String.fromCharCode(o)}return s}}class ae{static encode(e){let t=se.encode(e.numRestrictions,te.numRestrictions);if(!e.isEmpty()){const s=(t,s)=>{for(let n=t+1;n<=s;n++)if(e.gvl.vendorIds.has(n))return n;return t};e.getRestrictions().forEach((n=>{t+=se.encode(n.purposeId,te.purposeId),t+=se.encode(n.restrictionType,te.restrictionType);const r=e.getVendors(n),o=r.length;let i=0,a=0,c="";for(let e=0;es(t,r[o-1])){const e=!(t===a);c+=re.encode(e),c+=se.encode(a,te.vendorId),e&&(c+=se.encode(t,te.vendorId)),a=0}}t+=se.encode(i,te.numEntries),t+=c}))}return t}static decode(e){let t=0;const s=new Q,n=se.decode(e.substr(t,te.numRestrictions),te.numRestrictions);t+=te.numRestrictions;for(let r=0;r{o+=re.encode(r),s=e.maxId>c&&u{const t=1===e.length;s+=re.encode(!t),s+=se.encode(e[0],te.vendorId),t||(s+=se.encode(e[1],te.vendorId))})),s}}function ue(){return{[Z.version]:se,[Z.created]:ne,[Z.lastUpdated]:ne,[Z.cmpId]:se,[Z.cmpVersion]:se,[Z.consentScreen]:se,[Z.consentLanguage]:ie,[Z.vendorListVersion]:se,[Z.policyVersion]:se,[Z.isServiceSpecific]:re,[Z.useNonStandardTexts]:re,[Z.specialFeatureOptins]:oe,[Z.purposeConsents]:oe,[Z.purposeLegitimateInterests]:oe,[Z.purposeOneTreatment]:re,[Z.publisherCountryCode]:ie,[Z.vendorConsents]:ce,[Z.vendorLegitimateInterests]:ce,[Z.publisherRestrictions]:ae,segmentType:se,[Z.vendorsDisclosed]:ce,[Z.vendorsAllowed]:ce,[Z.publisherConsents]:oe,[Z.publisherLegitimateInterests]:oe,[Z.numCustomPurposes]:se,[Z.publisherCustomConsents]:oe,[Z.publisherCustomLegitimateInterests]:oe}}class le{1={[B.CORE]:[Z.version,Z.created,Z.lastUpdated,Z.cmpId,Z.cmpVersion,Z.consentScreen,Z.consentLanguage,Z.vendorListVersion,Z.purposeConsents,Z.vendorConsents]};2={[B.CORE]:[Z.version,Z.created,Z.lastUpdated,Z.cmpId,Z.cmpVersion,Z.consentScreen,Z.consentLanguage,Z.vendorListVersion,Z.policyVersion,Z.isServiceSpecific,Z.useNonStandardTexts,Z.specialFeatureOptins,Z.purposeConsents,Z.purposeLegitimateInterests,Z.purposeOneTreatment,Z.publisherCountryCode,Z.vendorConsents,Z.vendorLegitimateInterests,Z.publisherRestrictions],[B.VENDORS_DISCLOSED]:[Z.vendorsDisclosed],[B.PUBLISHER_TC]:[Z.publisherConsents,Z.publisherLegitimateInterests,Z.numCustomPurposes,Z.publisherCustomConsents,Z.publisherCustomLegitimateInterests],[B.VENDORS_ALLOWED]:[Z.vendorsAllowed]}}class de{1=[B.CORE];2=[B.CORE];constructor(e,t){if(2===e.version)if(e.isServiceSpecific)this[2].push(B.VENDORS_DISCLOSED),this[2].push(B.PUBLISHER_TC);else{const s=!(!t||!t.isForVendors);s&&!0!==e[Z.supportOOB]||this[2].push(B.VENDORS_DISCLOSED),s&&(e[Z.supportOOB]&&e[Z.vendorsAllowed].size>0&&this[2].push(B.VENDORS_ALLOWED),this[2].push(B.PUBLISHER_TC))}}}class pe{static fieldSequence=new le;static encode(e,t){let s;try{s=this.fieldSequence[String(e.version)][t]}catch(s){throw new z(`Unable to encode version: ${e.version}, segment: ${t}`)}let n="";t!==B.CORE&&(n=se.encode(X.KEY_TO_ID[t],te.segmentType));const r=ue();return s.forEach((s=>{const o=e[s],i=r[s];let a=te[s];void 0===a&&this.isPublisherCustom(s)&&(a=Number(e[Z.numCustomPurposes]));try{n+=i.encode(o,a)}catch(e){throw new z(`Error encoding ${t}->${s}: ${e.message}`)}})),Y.encode(n)}static decode(e,t,s){const n=Y.decode(e);let r=0;s===B.CORE&&(t.version=se.decode(n.substr(r,te[Z.version]),te[Z.version])),s!==B.CORE&&(r+=te.segmentType);const o=this.fieldSequence[String(t.version)][s],i=ue();return o.forEach((e=>{const s=i[e];let o=te[e];if(void 0===o&&this.isPublisherCustom(e)&&(o=Number(t[Z.numCustomPurposes])),0!==o){const i=n.substr(r,o);if(t[e]=s===ce?s.decode(i,t.version):s.decode(i,o),Number.isInteger(o))r+=o;else{if(!Number.isInteger(t[e].bitLength))throw new j(e);r+=t[e].bitLength}}})),t}static isPublisherCustom(e){return 0===e.indexOf("publisherCustom")}}class he{static processor=[e=>e,(e,t)=>{e.publisherRestrictions.gvl=t,e.purposeLegitimateInterests.unset([1,3,4,5,6]);const s=new Map;return s.set("legIntPurposes",e.vendorLegitimateInterests),s.set("purposes",e.vendorConsents),s.forEach(((s,n)=>{s.forEach(((r,o)=>{if(r){const r=t.vendors[o];if(!r||r.deletedDate)s.unset(o);else if(0===r[n].length)if("legIntPurposes"===n&&0===r.purposes.length&&0===r.legIntPurposes.length&&r.specialPurposes.length>0)s.set(o);else if("legIntPurposes"===n&&r.purposes.length>0&&0===r.legIntPurposes.length&&r.specialPurposes.length>0)s.set(o);else if(e.isServiceSpecific)if(0===r.flexiblePurposes.length)s.unset(o);else{const t=e.publisherRestrictions.getRestrictions(o);let r=!1;for(let e=0,s=t.length;e0&&t?.version<=this.processor.length?e.version=t.version:e.version=this.processor.length;const n=e.version-1;if(!this.processor[n])throw new z(`Invalid version: ${e.version}`);return this.processor[n](e,s)}}class fe{static absCall(e,t,s,n){return new Promise(((r,o)=>{const i=new XMLHttpRequest;i.withCredentials=s,i.addEventListener("load",(()=>{if(i.readyState==XMLHttpRequest.DONE)if(i.status>=200&&i.status<300){let e=i.response;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}r(e)}else o(new Error(`HTTP Status: ${i.status} response type: ${i.responseType}`))})),i.addEventListener("error",(()=>{o(new Error("error"))})),i.addEventListener("abort",(()=>{o(new Error("aborted"))})),null===t?i.open("GET",e,!0):i.open("POST",e,!0),i.responseType="json",i.timeout=n,i.ontimeout=()=>{o(new Error("Timeout "+n+"ms "+e))},i.send(t)}))}static post(e,t,s=!1,n=0){return this.absCall(e,JSON.stringify(t),s,n)}static fetch(e,t=!1,s=0){return this.absCall(e,null,t,s)}}class ge extends q{static LANGUAGE_CACHE=new Map;static CACHE=new Map;static LATEST_CACHE_KEY=0;static DEFAULT_LANGUAGE="EN";static consentLanguages=new K;static baseUrl_;static set baseUrl(e){if(/^https?:\/\/vendorlist\.consensu\.org\//.test(e))throw new W("Invalid baseUrl! You may not pull directly from vendorlist.consensu.org and must provide your own cache");e.length>0&&"/"!==e[e.length-1]&&(e+="/"),this.baseUrl_=e}static get baseUrl(){return this.baseUrl_}static latestFilename="vendor-list.json";static versionedFilename="archives/vendor-list-v[VERSION].json";static languageFilename="purposes-[LANG].json";readyPromise;gvlSpecificationVersion;vendorListVersion;tcfPolicyVersion;lastUpdated;purposes;specialPurposes;features;specialFeatures;isReady_=!1;vendors_;vendorIds;fullVendorList;byPurposeVendorMap;bySpecialPurposeVendorMap;byFeatureVendorMap;bySpecialFeatureVendorMap;stacks;dataCategories;lang_;cacheLang_;isLatest=!1;constructor(e,t){super();let s=ge.baseUrl,n=t?.language;if(n)try{n=ge.consentLanguages.parseLanguage(n)}catch(e){throw new W("Error during parsing the language: "+e.message)}if(this.lang_=n||ge.DEFAULT_LANGUAGE,this.cacheLang_=n||ge.DEFAULT_LANGUAGE,this.isVendorList(e))this.populate(e),this.readyPromise=Promise.resolve();else{if(!s)throw new W("must specify GVL.baseUrl before loading GVL json");if(e>0){const t=e;ge.CACHE.has(t)?(this.populate(ge.CACHE.get(t)),this.readyPromise=Promise.resolve()):(s+=ge.versionedFilename.replace("[VERSION]",String(t)),this.readyPromise=this.fetchJson(s))}else ge.CACHE.has(ge.LATEST_CACHE_KEY)?(this.populate(ge.CACHE.get(ge.LATEST_CACHE_KEY)),this.readyPromise=Promise.resolve()):(this.isLatest=!0,this.readyPromise=this.fetchJson(s+ge.latestFilename))}}static emptyLanguageCache(e){let t=!1;return null==e&&ge.LANGUAGE_CACHE.size>0?(ge.LANGUAGE_CACHE=new Map,t=!0):"string"==typeof e&&this.consentLanguages.has(e.toUpperCase())&&(ge.LANGUAGE_CACHE.delete(e.toUpperCase()),t=!0),t}static emptyCache(e){let t=!1;return Number.isInteger(e)&&e>=0?(ge.CACHE.delete(e),t=!0):void 0===e&&(ge.CACHE=new Map,t=!0),t}cacheLanguage(){ge.LANGUAGE_CACHE.has(this.cacheLang_)||ge.LANGUAGE_CACHE.set(this.cacheLang_,{purposes:this.purposes,specialPurposes:this.specialPurposes,features:this.features,specialFeatures:this.specialFeatures,stacks:this.stacks,dataCategories:this.dataCategories})}async fetchJson(e){try{this.populate(await fe.fetch(e))}catch(e){throw new W(e.message)}}getJson(){return{gvlSpecificationVersion:this.gvlSpecificationVersion,vendorListVersion:this.vendorListVersion,tcfPolicyVersion:this.tcfPolicyVersion,lastUpdated:this.lastUpdated,purposes:this.clonePurposes(),specialPurposes:this.cloneSpecialPurposes(),features:this.cloneFeatures(),specialFeatures:this.cloneSpecialFeatures(),stacks:this.cloneStacks(),...this.dataCategories?{dataCategories:this.cloneDataCategories()}:{},vendors:this.cloneVendors()}}cloneSpecialFeatures(){const e={};for(const t of Object.keys(this.specialFeatures))e[t]=ge.cloneFeature(this.specialFeatures[t]);return e}cloneFeatures(){const e={};for(const t of Object.keys(this.features))e[t]=ge.cloneFeature(this.features[t]);return e}cloneStacks(){const e={};for(const t of Object.keys(this.stacks))e[t]=ge.cloneStack(this.stacks[t]);return e}cloneDataCategories(){const e={};for(const t of Object.keys(this.dataCategories))e[t]=ge.cloneDataCategory(this.dataCategories[t]);return e}cloneSpecialPurposes(){const e={};for(const t of Object.keys(this.specialPurposes))e[t]=ge.clonePurpose(this.specialPurposes[t]);return e}clonePurposes(){const e={};for(const t of Object.keys(this.purposes))e[t]=ge.clonePurpose(this.purposes[t]);return e}static clonePurpose(e){return{id:e.id,name:e.name,description:e.description,...e.descriptionLegal?{descriptionLegal:e.descriptionLegal}:{},...e.illustrations?{illustrations:Array.from(e.illustrations)}:{}}}static cloneFeature(e){return{id:e.id,name:e.name,description:e.description,...e.descriptionLegal?{descriptionLegal:e.descriptionLegal}:{},...e.illustrations?{illustrations:Array.from(e.illustrations)}:{}}}static cloneDataCategory(e){return{id:e.id,name:e.name,description:e.description}}static cloneStack(e){return{id:e.id,name:e.name,description:e.description,purposes:Array.from(e.purposes),specialFeatures:Array.from(e.specialFeatures)}}static cloneDataRetention(e){return{..."number"==typeof e.stdRetention?{stdRetention:e.stdRetention}:{},purposes:{...e.purposes},specialPurposes:{...e.specialPurposes}}}static cloneVendorUrls(e){return e.map((e=>({langId:e.langId,privacy:e.privacy,...e.legIntClaim?{legIntClaim:e.legIntClaim}:{}})))}static cloneVendor(e){return{id:e.id,name:e.name,purposes:Array.from(e.purposes),legIntPurposes:Array.from(e.legIntPurposes),flexiblePurposes:Array.from(e.flexiblePurposes),specialPurposes:Array.from(e.specialPurposes),features:Array.from(e.features),specialFeatures:Array.from(e.specialFeatures),...e.overflow?{overflow:{httpGetLimit:e.overflow.httpGetLimit}}:{},..."number"==typeof e.cookieMaxAgeSeconds||null===e.cookieMaxAgeSeconds?{cookieMaxAgeSeconds:e.cookieMaxAgeSeconds}:{},...void 0!==e.usesCookies?{usesCookies:e.usesCookies}:{},...e.policyUrl?{policyUrl:e.policyUrl}:{},...void 0!==e.cookieRefresh?{cookieRefresh:e.cookieRefresh}:{},...void 0!==e.usesNonCookieAccess?{usesNonCookieAccess:e.usesNonCookieAccess}:{},...e.dataRetention?{dataRetention:this.cloneDataRetention(e.dataRetention)}:{},...e.urls?{urls:this.cloneVendorUrls(e.urls)}:{},...e.dataDeclaration?{dataDeclaration:Array.from(e.dataDeclaration)}:{},...e.deviceStorageDisclosureUrl?{deviceStorageDisclosureUrl:e.deviceStorageDisclosureUrl}:{},...e.deletedDate?{deletedDate:e.deletedDate}:{}}}cloneVendors(){const e={};for(const t of Object.keys(this.fullVendorList))e[t]=ge.cloneVendor(this.fullVendorList[t]);return e}async changeLanguage(e){let t=e;try{t=ge.consentLanguages.parseLanguage(e)}catch(e){throw new W("Error during parsing the language: "+e.message)}const s=e.toUpperCase();if((t.toLowerCase()!==ge.DEFAULT_LANGUAGE.toLowerCase()||ge.LANGUAGE_CACHE.has(s))&&t!==this.lang_)if(this.lang_=t,ge.LANGUAGE_CACHE.has(s)){const e=ge.LANGUAGE_CACHE.get(s);for(const t in e)e.hasOwnProperty(t)&&(this[t]=e[t])}else{const e=ge.baseUrl+ge.languageFilename.replace("[LANG]",this.lang_.toLowerCase());try{await this.fetchJson(e),this.cacheLang_=s,this.cacheLanguage()}catch(e){throw new W("unable to load language: "+e.message)}}}get language(){return this.lang_}isVendorList(e){return void 0!==e&&void 0!==e.vendors}populate(e){this.purposes=e.purposes,this.specialPurposes=e.specialPurposes,this.features=e.features,this.specialFeatures=e.specialFeatures,this.stacks=e.stacks,this.dataCategories=e.dataCategories,this.isVendorList(e)&&(this.gvlSpecificationVersion=e.gvlSpecificationVersion,this.tcfPolicyVersion=e.tcfPolicyVersion,this.vendorListVersion=e.vendorListVersion,this.lastUpdated=e.lastUpdated,"string"==typeof this.lastUpdated&&(this.lastUpdated=new Date(this.lastUpdated)),this.vendors_=e.vendors,this.fullVendorList=e.vendors,this.mapVendors(),this.isReady_=!0,this.isLatest&&ge.CACHE.set(ge.LATEST_CACHE_KEY,this.getJson()),ge.CACHE.has(this.vendorListVersion)||ge.CACHE.set(this.vendorListVersion,this.getJson())),this.cacheLanguage()}mapVendors(e){this.byPurposeVendorMap={},this.bySpecialPurposeVendorMap={},this.byFeatureVendorMap={},this.bySpecialFeatureVendorMap={},Object.keys(this.purposes).forEach((e=>{this.byPurposeVendorMap[e]={legInt:new Set,consent:new Set,flexible:new Set}})),Object.keys(this.specialPurposes).forEach((e=>{this.bySpecialPurposeVendorMap[e]=new Set})),Object.keys(this.features).forEach((e=>{this.byFeatureVendorMap[e]=new Set})),Object.keys(this.specialFeatures).forEach((e=>{this.bySpecialFeatureVendorMap[e]=new Set})),Array.isArray(e)||(e=Object.keys(this.fullVendorList).map((e=>+e))),this.vendorIds=new Set(e),this.vendors_=e.reduce(((e,t)=>{const s=this.vendors_[String(t)];return s&&void 0===s.deletedDate&&(s.purposes.forEach((e=>{this.byPurposeVendorMap[String(e)].consent.add(t)})),s.specialPurposes.forEach((e=>{this.bySpecialPurposeVendorMap[String(e)].add(t)})),s.legIntPurposes.forEach((e=>{this.byPurposeVendorMap[String(e)].legInt.add(t)})),s.flexiblePurposes&&s.flexiblePurposes.forEach((e=>{this.byPurposeVendorMap[String(e)].flexible.add(t)})),s.features.forEach((e=>{this.byFeatureVendorMap[String(e)].add(t)})),s.specialFeatures.forEach((e=>{this.bySpecialFeatureVendorMap[String(e)].add(t)})),e[t]=s),e}),{})}getFilteredVendors(e,t,s,n){const r=e.charAt(0).toUpperCase()+e.slice(1);let o;const i={};return o="purpose"===e&&s?this["by"+r+"VendorMap"][String(t)][s]:this["by"+(n?"Special":"")+r+"VendorMap"][String(t)],o.forEach((e=>{i[String(e)]=this.vendors[String(e)]})),i}getVendorsWithConsentPurpose(e){return this.getFilteredVendors("purpose",e,"consent")}getVendorsWithLegIntPurpose(e){return this.getFilteredVendors("purpose",e,"legInt")}getVendorsWithFlexiblePurpose(e){return this.getFilteredVendors("purpose",e,"flexible")}getVendorsWithSpecialPurpose(e){return this.getFilteredVendors("purpose",e,void 0,!0)}getVendorsWithFeature(e){return this.getFilteredVendors("feature",e)}getVendorsWithSpecialFeature(e){return this.getFilteredVendors("feature",e,void 0,!0)}get vendors(){return this.vendors_}narrowVendorsTo(e){this.mapVendors(e)}get isReady(){return this.isReady_}clone(){const e=new ge(this.getJson());return this.lang_!==ge.DEFAULT_LANGUAGE&&e.changeLanguage(this.lang_),e}static isInstanceOf(e){return"object"==typeof e&&"function"==typeof e.narrowVendorsTo}}class ve extends q{static consentLanguages=ge.consentLanguages;isServiceSpecific_=!0;supportOOB_=!1;useNonStandardTexts_=!1;purposeOneTreatment_=!1;publisherCountryCode_="AA";version_=2;consentScreen_=0;policyVersion_=5;consentLanguage_="EN";cmpId_=0;cmpVersion_=0;vendorListVersion_=0;numCustomPurposes_=0;gvl_;created;lastUpdated;specialFeatureOptins=new ee;purposeConsents=new ee;purposeLegitimateInterests=new ee;publisherConsents=new ee;publisherLegitimateInterests=new ee;publisherCustomConsents=new ee;publisherCustomLegitimateInterests=new ee;customPurposes;vendorConsents=new ee;vendorLegitimateInterests=new ee;vendorsDisclosed=new ee;vendorsAllowed=new ee;publisherRestrictions=new Q;constructor(e){super(),e&&(this.gvl=e),this.updated()}set gvl(e){ge.isInstanceOf(e)||(e=new ge(e)),this.gvl_=e,this.publisherRestrictions.gvl=e}get gvl(){return this.gvl_}set cmpId(e){if(e=Number(e),!(Number.isInteger(e)&&e>1))throw new $("cmpId",e);this.cmpId_=e}get cmpId(){return this.cmpId_}set cmpVersion(e){if(e=Number(e),!(Number.isInteger(e)&&e>-1))throw new $("cmpVersion",e);this.cmpVersion_=e}get cmpVersion(){return this.cmpVersion_}set consentScreen(e){if(e=Number(e),!(Number.isInteger(e)&&e>-1))throw new $("consentScreen",e);this.consentScreen_=e}get consentScreen(){return this.consentScreen_}set consentLanguage(e){this.consentLanguage_=e}get consentLanguage(){return this.consentLanguage_}set publisherCountryCode(e){if(!/^([A-z]){2}$/.test(e))throw new $("publisherCountryCode",e);this.publisherCountryCode_=e.toUpperCase()}get publisherCountryCode(){return this.publisherCountryCode_}set vendorListVersion(e){if((e=Number(e)>>0)<0)throw new $("vendorListVersion",e);this.vendorListVersion_=e}get vendorListVersion(){return this.gvl?this.gvl.vendorListVersion:this.vendorListVersion_}set policyVersion(e){if(this.policyVersion_=parseInt(e,10),this.policyVersion_<0)throw new $("policyVersion",e)}get policyVersion(){return this.gvl?this.gvl.tcfPolicyVersion:this.policyVersion_}set version(e){this.version_=parseInt(e,10)}get version(){return this.version_}set isServiceSpecific(e){this.isServiceSpecific_=e}get isServiceSpecific(){return this.isServiceSpecific_}set useNonStandardTexts(e){this.useNonStandardTexts_=e}get useNonStandardTexts(){return this.useNonStandardTexts_}set supportOOB(e){this.supportOOB_=e}get supportOOB(){return this.supportOOB_}set purposeOneTreatment(e){this.purposeOneTreatment_=e}get purposeOneTreatment(){return this.purposeOneTreatment_}setAllVendorConsents(){this.vendorConsents.set(this.gvl.vendors)}unsetAllVendorConsents(){this.vendorConsents.empty()}setAllVendorsDisclosed(){this.vendorsDisclosed.set(this.gvl.vendors)}unsetAllVendorsDisclosed(){this.vendorsDisclosed.empty()}setAllVendorsAllowed(){this.vendorsAllowed.set(this.gvl.vendors)}unsetAllVendorsAllowed(){this.vendorsAllowed.empty()}setAllVendorLegitimateInterests(){this.vendorLegitimateInterests.set(this.gvl.vendors)}unsetAllVendorLegitimateInterests(){this.vendorLegitimateInterests.empty()}setAllPurposeConsents(){this.purposeConsents.set(this.gvl.purposes)}unsetAllPurposeConsents(){this.purposeConsents.empty()}setAllPurposeLegitimateInterests(){this.purposeLegitimateInterests.set(this.gvl.purposes)}unsetAllPurposeLegitimateInterests(){this.purposeLegitimateInterests.empty()}setAllSpecialFeatureOptins(){this.specialFeatureOptins.set(this.gvl.specialFeatures)}unsetAllSpecialFeatureOptins(){this.specialFeatureOptins.empty()}setAll(){this.setAllVendorConsents(),this.setAllPurposeLegitimateInterests(),this.setAllSpecialFeatureOptins(),this.setAllPurposeConsents(),this.setAllVendorLegitimateInterests()}unsetAll(){this.unsetAllVendorConsents(),this.unsetAllPurposeLegitimateInterests(),this.unsetAllSpecialFeatureOptins(),this.unsetAllPurposeConsents(),this.unsetAllVendorLegitimateInterests()}get numCustomPurposes(){let e=this.numCustomPurposes_;if("object"==typeof this.customPurposes){const t=Object.keys(this.customPurposes).sort(((e,t)=>Number(e)-Number(t)));e=parseInt(t.pop(),10)}return e}set numCustomPurposes(e){if(this.numCustomPurposes_=parseInt(e,10),this.numCustomPurposes_<0)throw new $("numCustomPurposes",e)}updated(){const e=new Date,t=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));this.created=t,this.lastUpdated=t}}class me{static encode(e,t){let s,n="";return e=he.process(e,t),s=Array.isArray(t?.segments)?t.segments:new de(e,t)[""+e.version],s.forEach(((t,r)=>{let o="";r0;if(r&&!0===n[164])return P.Disclosed;var o=t0;if(s&&t.has(y))return P.Disclosed;var n=e.created0&&r[r.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]3e5)&&!I.getParamFromUrl(f)&&(Re.setCachedClickId=(e=function(){var e,s=document.createElement("script"),n="string"==typeof(e=Re.marketerId)?e:t(e)?e.join(","):void 0;s.src=O()+"/cachedClickId?marketerId="+n,r.body.appendChild(s)},s=function(){D.set(v,Date.now(),5/1440)},ke.checkHasConsent((function(t){t&&e()})),this.eventBusService.on(u,(function(t){t&&e()})),function(e){if("optout"!==e)if("NoClickId"===e)Re.zone===i.Default?s():(ke.checkHasConsent((function(e){e&&s()})),this.eventBusService.on(u,(function(e){e&&s()})));else{var t=I.getParamFromUrl(m);e&&(e=e.replace(/#/g,"")),D.set(g,e,7,t)}}))},e}();var Fe=Re.zone===i.Default;try{var xe=new Pe;!function(e){e.addVariation=function(t){if(e.variations||(e.variations=[]),!(e.variations.indexOf(t)>-1)){e.variations.push(t);var s=D.get("variations"),n=s?s.split(",").map((function(e){return parseInt(e)})):[];n.indexOf(t)>-1||D.set("variations","".concat(Oe(Oe([],n,!0),[t],!1)))}}}(Re),new function(){var e=this;if(history.pushState&&history.replaceState&&window.addEventListener){var t=function(t){location.href!==e.lastVisited&&t&&(e.lastVisited=location.href,Re("track",p))};n(history,"pushState",t),n(history,"replaceState",t),window.addEventListener("popstate",t,!1)}},_.on(u,(function(e){(Fe=e)&&(xe.getClickIdCookieCached()&&(setTimeout((function(){obApi("track",h)}),1e4),document.addEventListener("visibilitychange",(function(){document.hidden&&obApi("track","AUTO_TAB_LOST_FOCUS")})),window.addEventListener("beforeunload",(function(e){obApi("track","AUTO_NAVIGATE_ANOTHER_SITE")}))),function(){var e,t;function s(e){var t=document.createElement("script");t.async=!0,t.src=e,t.type="text/javascript";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(t,s)}var n=function(e){var t,r;if(["https://my.outbrain.com","http://localhost:4949","http://localhost:2109","https://simsite.outbrain.com"].indexOf(e.origin)>-1&&"SHOW_EVENT_PICKER"===(null===(t=e.data)||void 0===t?void 0:t.message)){var o=((null===(r=e.data)||void 0===r?void 0:r.content)||{}).appName;s("https://my.outbrain.com/events-picker-app?appName=".concat(o||"codeless")),window.opener.postMessage({message:"EVENT_PICKER_CONNECTED"},e.origin),window.removeEventListener("message",n)}};window.addEventListener("message",n),null===(t=null===(e=null===top||void 0===top?void 0:top.window.opener)||void 0===e?void 0:e.postMessage)||void 0===t||t.call(e,{message:"OB_SHOULD_SHOW_PICKER",content:{marketerId:Re.marketerId}},"*");try{Array.isArray(Re.marketerId)&&Re.marketerId.filter((function(e){return!!e})).slice(0,9).forEach((function(e){return s("".concat(V()?"https://p.teads.tv/obwave/":"https://wave.outbrain.com/","mtWavesBundler/handler/").concat(e.trim()))}))}catch(e){A(e,Re)}}(),function(){if("browsingTopics"in document&&"featurePolicy"in document&&window.document.featurePolicy.allowsFeature("browsing-topics")){var e=V()?"https://p.teads.tv/obtp/topics":"https://amplify.outbrain.com/topics";fetch(e,{browsingTopics:!0}).then((function(){})).catch((function(){}))}}())})),Re.dispatch.apply(Re),new Ue(_).getCachedClickId()}catch(e){Fe&&A(e,Re)}return e})()));